log using "$logpath/01_Tables_JEEA_final", replace
******************************************************************************************************************
*****TABLE 1: DESTRUCTIVE BEHAVIOR IN GROUPS, EXPERIMENT 1 (UNIVERSITY STUDENTS)
*******************************************************************************************************************

use "$cleandatapath/Experiment1.dta", replace

tab Treatment
gen GC_Hidden=0
replace GC_Hidden=1 if Treatment==2
label variable GC_Hidden "GroupContext_Hidden"
gen GC_Observed=0
replace GC_Observed=1 if Treatment==3
label variable GC_Hidden "GroupContext_Observed"
gen Group=0
replace Group=1 if Treatment==4

gen JDCQ=JD_CQ1+JD_CQ2+JD_CQ3+JD_CQ4
tab JDCQ

quietly tabulate experimenter, generate(d_experimenter_)
quietly tabulate JDCQ, generate(d_JDCQ_)

tab faculty_econ_mngm 
global x_experimenter d_experimenter_2 d_experimenter_3 d_experimenter_4 d_experimenter_5 d_experimenter_6 d_experimenter_7 d_experimenter_8 d_experimenter_9 d_experimenter_10
global x_understanding d_JDCQ_1 d_JDCQ_2 d_JDCQ_3 d_JDCQ_4 //d_JDCQ_5=full understanding, excluded

tab order_JDPD //order effect
rename order_JDPD JD_first

rename female Female
rename age Age

sum $x_experimenter JD_first
sum Female Age faculty_econ_mngm  Educ_mother_1 Educ_mother_2 Educ_mother_3 Educ_father_1 Educ_father_2 Educ_father_3
global x_observables Female Age faculty_econ_mngm  Educ_mother_1 Educ_mother_2 Educ_mother_3 Educ_father_1 Educ_father_2 Educ_father_3 

ttest JD_ifnice if (Treatment==2|Treatment==3), by(Treatment)
tab JD_ifnice Treatment if (Treatment==2|Treatment==3), chi2

ttest JD_index if (Treatment==2|Treatment==3), by(Treatment)
ranksum JD_index if (Treatment==2|Treatment==3), by(Treatment)

******************************************************************
****Table 1, Panel A (Conditional if nice)

reg JD_ifnice GC_Hidden GC_Observed Group, robust
outreg2 using "$outputpath/Tables/Tab1_A.xls", replace ctitle(No controls) keep(GC_Hidden GC_Observed Group) addtext(Mean_Individual, 0.04, Design, NO, Observables, NO) nocons nor2 dec(2) label
test _b[GC_Hidden] = _b[GC_Observed] 
test _b[GC_Hidden] = _b[Group] 
test _b[GC_Observed] = _b[Group] 


reg JD_ifnice GC_Hidden GC_Observed Group JD_first $x_experimenter, robust
outreg2 using "$outputpath/Tables/Tab1_A.xls", append ctitle(Design) keep(GC_Hidden GC_Observed Group) addtext(Mean_Individual, 0.04, Design, YES, Observables, NO) nocons nor2 dec(2) label  
test _b[GC_Hidden] = _b[GC_Observed] 
test _b[GC_Hidden] = _b[Group] 
test _b[GC_Observed] = _b[Group] 

reg JD_ifnice GC_Hidden GC_Observed JD_first $x_experimenter $x_observables if Treatment<4, robust
outreg2 using "$outputpath/Tables/Tab1_A.xls", append ctitle(Observables) keep(GC_Hidden GC_Observed) addtext(Mean_Individual, 0.04, Design, YES, Observables, YES) nocons nor2 dec(2) label  
test _b[GC_Hidden] = _b[GC_Observed] 

reg JD_ifnice GC_Hidden GC_Observed JD_first $x_experimenter if JDCQ==4 , robust
outreg2 using "$outputpath/Tables/Tab1_A.xls", append ctitle(Excluding non-und) keep(GC_Hidden GC_Observed) addtext(Mean_Individual, 0.03, Design, YES, Observables, NO) nocons nor2 dec(2) label 
test _b[GC_Hidden] = _b[GC_Observed] 

reg JD_ifnice GC_Hidden GC_Observed Group JD_first $x_experimenter if JD_first==1  , robust
outreg2 using "$outputpath/Tables/Tab1_A.xls", append ctitle(Only JD played first) keep(GC_Hidden GC_Observed Group) addtext(Mean_Individual, 0.03, Design, YES, Observables, NO) nocons nor2 dec(2) label  
test _b[GC_Hidden] = _b[GC_Observed] 
test _b[GC_Hidden] = _b[Group] 
test _b[GC_Observed] = _b[Group] 


reg JD_ifnice GC_Hidden GC_Observed Group JD_first $x_experimenter, cluster(ID_indgroup)
outreg2 using "$outputpath/Tables/Tab1_A.xls", append ctitle(Design) keep(GC_Hidden GC_Observed Group) addtext(Mean_Individual, 0.04, Design, YES, Observables, NO) nocons nor2 dec(2) label  
test _b[GC_Hidden] = _b[GC_Observed] 
test _b[GC_Hidden] = _b[Group] 
test _b[GC_Observed] = _b[Group] 


logit JD_ifnice GC_Hidden GC_Observed Group JD_first $x_experimenter, robust
mfx
outreg2 using "$outputpath/Tables/Tab1_A.xls", append ctitle(logit) mfx keep(GC_Hidden GC_Observed Group) addtext(Mean_Individual, 0.04, Design, YES, Observables, NO) nocons nor2 dec(2) label  
test _b[GC_Hidden] = _b[GC_Observed] 
test _b[GC_Hidden] = _b[Group] 
test _b[GC_Observed] = _b[Group] 

*Means Individual
sum JD_ifnice if Treatment==1
sum JD_ifnice if Treatment==1 & JDCQ==4
sum JD_ifnice if Treatment==1 & JD_first==1

******************************************************************
****Table 1, Panel B (index)

reg JD_index GC_Hidden GC_Observed Group, robust
outreg2 using "$outputpath/Tables/Tab1_B.xls", replace ctitle(No controls) keep(GC_Hidden GC_Observed Group) addtext(Mean_Individual, 0.20, Design, NO, Observables, NO) nocons nor2 dec(2) label
test _b[GC_Hidden] = _b[GC_Observed] 
test _b[GC_Hidden] = _b[Group] 
test _b[GC_Observed] = _b[Group] 

reg JD_index GC_Hidden GC_Observed Group JD_first $x_experimenter, robust
outreg2 using "$outputpath/Tables/Tab1_B.xls", append ctitle(Design) keep(GC_Hidden GC_Observed Group) addtext(Mean_Individual, 0.20, Design, YES, Observables, NO) nocons nor2 dec(2) label  
test _b[GC_Hidden] = _b[GC_Observed] 
test _b[GC_Hidden] = _b[Group] 
test _b[GC_Observed] = _b[Group] 

reg JD_index GC_Hidden GC_Observed JD_first $x_experimenter $x_observables if Treatment<4, robust
outreg2 using "$outputpath/Tables/Tab1_B.xls", append ctitle(Observables) keep(GC_Hidden GC_Observed) addtext(Mean_Individual, 0.20, Design, YES, Observables, YES) nocons nor2 dec(2) label  
test _b[GC_Hidden] = _b[GC_Observed] 


reg JD_index GC_Hidden GC_Observed JD_first $x_experimenter if JDCQ==4 & Treatment<4, robust
outreg2 using "$outputpath/Tables/Tab1_B.xls", append ctitle(Excluding non-und) keep(GC_Hidden GC_Observed) addtext(Mean_Individual, 0.19, Design, YES, Observables, NO) nocons nor2 dec(2) label  
test _b[GC_Hidden] = _b[GC_Observed] 


reg JD_index GC_Hidden GC_Observed Group JD_first $x_experimenter if JD_first==1, robust
outreg2 using "$outputpath/Tables/Tab1_B.xls", append ctitle(Only JD played first) keep(GC_Hidden GC_Observed Group) addtext(Mean_Individual, 0.19, Design, YES, Observables, NO) nocons nor2 dec(2) label  
test _b[GC_Hidden] = _b[GC_Observed] 
test _b[GC_Hidden] = _b[Group] 
test _b[GC_Observed] = _b[Group] 


reg JD_index GC_Hidden GC_Observed Group JD_first $x_experimenter, cluster(ID_indgroup)
outreg2 using "$outputpath/Tables/Tab1_B.xls", append ctitle(Design) keep(GC_Hidden GC_Observed Group) addtext(Mean_Individual, 0.20, Design, YES, Observables, NO) nocons nor2 dec(2) label  
test _b[GC_Hidden] = _b[GC_Observed] 
test _b[GC_Hidden] = _b[Group] 
test _b[GC_Observed] = _b[Group] 

*Means Individual
sum JD_index if Treatment==1
sum JD_index if Treatment==1 & JDCQ==4
sum JD_index if Treatment==1 & JD_first==1

******************************************************************************************************************
*****TABLE 2: DESTRUCTIVE BEHAVIOR IN GROUPS, EXPERIMENT 2 (REPRESENTATIVE SAMPLE OF ADULT POPULATION)
*******************************************************************************************************************

use "$cleandatapath/Experiment2.dta", replace

tab Treatment
gen GC_Hidden=0
replace GC_Hidden=1 if Treatment==2

tab JD_first //order effect

rename age Age
global x_observables Female age_cat_2 age_cat_3 age_cat_4 age_cat_5 age_cat_6 edu_hig edu_uni size_place_2 size_place_3 size_place_4 size_place_5 region_2 region_3 region_4 region_5 region_6 region_7 region_8 HHincome_2 HHincome_3 HHincome_4 HHincome_5 HHincome_6 HHincome_7 HHincome_8 HHincome_9 HHincome_10 


******************************************************************
****Table 2, Panel A (Conditional if nice)

reg JD_ifnice GC_Hidden , robust
outreg2 using "$outputpath/Tables/Tab2_A.xls", replace ctitle(No controls) keep(GC_Hidden) addtext(Mean_Individual, 0.13, Design, NO,  Observables, NO) nocons nor2 dec(2) label

reg JD_ifnice GC_Hidden JD_first  , robust
outreg2 using "$outputpath/Tables/Tab2_A.xls", append ctitle(Design) keep(GC_Hidden) addtext(Mean_Individual, 0.13, Design, YES,  Observables, NO) nocons nor2  dec(2) label  

reg JD_ifnice GC_Hidden JD_first $x_observables , robust
outreg2 using "$outputpath/Tables/Tab2_A.xls", append ctitle(Observables) keep(GC_Hidden) addtext(Mean_Individual, 0.13, Design, YES,  Observables, YES) nocons nor2  dec(2) label  

reg JD_ifnice GC_Hidden  if JD_first==1, robust
outreg2 using "$outputpath/Tables/Tab2_A.xls", append ctitle(Only JD played first) keep(GC_Hidden) addtext(Mean_Individual, 0.11, Design, YES,  Observables, NO) nocons nor2  dec(2) label  

logit JD_ifnice GC_Hidden JD_first , robust
mfx 
outreg2 using "$outputpath/Tables/Tab2_A.xls", append mfx ctitle(Logit) keep(GC_Hidden) addtext(Mean_Individual, 0.13, Design, YES,  Observables, NO)  nocons nor2 dec(2) label  


*Means Individual
sum JD_ifnice if Treatment==1
sum JD_ifnice if Treatment==1 & JD_first==1

******************************************************************
****Table 2, Panel B (Index)

reg JD_index GC_Hidden , robust
outreg2 using "$outputpath/Tables/Tab2_B.xls", replace ctitle(No controls) keep(GC_Hidden) addtext(Mean_Individual, 0.21, Design, NO,  Observables, NO)  nocons nor2 dec(2) label

reg JD_index GC_Hidden JD_first  , robust
outreg2 using "$outputpath/Tables/Tab2_B.xls", append ctitle(Design) keep(GC_Hidden) addtext(Mean_Individual, 0.21, Design, YES,  Observables, NO) nocons nor2  dec(2) label  

reg JD_index GC_Hidden JD_first $x_observables , robust
outreg2 using "$outputpath/Tables/Tab2_B.xls", append ctitle(Observables) keep(GC_Hidden) addtext(Mean_Individual, 0.21, Design, YES,  Observables, YES) nocons nor2  dec(2) label  

reg JD_index GC_Hidden  if JD_first==1, robust
outreg2 using "$outputpath/Tables/Tab2_B.xls", append ctitle(Only JD played first) keep(GC_Hidden) addtext(Mean_Individual, 0.18, Design, YES,  Observables, NO) nocons nor2 dec(2) label  

*Means Individual
sum JD_index if Treatment==1
sum JD_index if Treatment==1 & JD_first==1

******************************************************************************************************************
*****TABLE 3: DESTRUCTIVE BEHAVIOR IN GROUPS, EXPERIMENT 3 (REPRESENTATIVE SAMPLE OF ADULT POPULATION)
*******************************************************************************************************************
use "$cleandatapath/Experiment3.dta", clear


preserve 
keep if completed_experiment==1

tab decision_main, nolabel


foreach var of varlist HHincome_1 HHincome_2 HHincome_3 HHincome_4 HHincome_5 HHincome_6 HHincome_7 HHincome_8 HHincome_9 HHincome_10 HHincome_11 {
replace `var'=0 if `var'==. 

}
recode HHincome (1/11=0) (.=1), gen(HHincome_12)
sum HHincome_1 HHincome_2 HHincome_3 HHincome_4 HHincome_5 HHincome_6 HHincome_7 HHincome_8 HHincome_9 HHincome_10 HHincome_11 HHincome_12


global x_observables Female age_cat_2 age_cat_3 age_cat_4 age_cat_5 age_cat_6 edu_cat_2 edu_cat_3 size_place_2 size_place_3 size_place_4 size_place_5 region_2 region_3 region_4 region_5 region_6 region_7 region_8 
global x_income HHincome_2 HHincome_3 HHincome_4 HHincome_5 HHincome_6 HHincome_7 HHincome_8 HHincome_9 HHincome_10 HHincome_11 HHincome_12
recode COSTLY (1=0) (0=1), gen(COSTLESS)

*********************************************************
****Table 3 Panel A

reg antisocial Treatment_GC if COSTLY==1 , robust
outreg2 using "$outputpath/Tables/Tab3_A.xls", replace ctitle(COSTLY, no controls) keep(Treatment_GC) addtext(Mean baseline, 0.033, Observables, No, Excluding non-attentive subjects, No)  stats(coef se pval)  paren(se) bracket(pval) dec(3) label  nocons

reg antisocial Treatment_GC $x_observables $x_income if COSTLY==1 , robust
outreg2 using "$outputpath/Tables/Tab3_A.xls", append ctitle(COSTLY, observables) keep(Treatment_GC) addtext(Mean baseline, 0.033, Observables, Yes, Excluding non-attentive subjects, No)  stats(coef se pval)  paren(se) bracket(pval) dec(3) label  nocons

reg antisocial Treatment_GC $x_observables $x_income if COSTLY==1 & Attention_full==1, robust
outreg2 using "$outputpath/Tables/Tab3_A.xls", append ctitle(COSTLY, full attention) keep(Treatment_GC) addtext(Mean baseline, 0.028, Observables, Yes, Excluding non-attentive subjects, Yes)  stats(coef se pval)  paren(se) bracket(pval) dec(3) label  nocons

logit antisocial Treatment_GC $x_observables $x_income if COSTLY==1 
mfx
outreg2 using "$outputpath/Tables/Tab3_A.xls", append mfx ctitle(COSTLY, logit) keep(Treatment_GC) addtext(Mean baseline, 0.033, Observables, Yes, Excluding non-attentive subjects, No)  stats(coef se pval)  paren(se) bracket(pval) dec(3) label  nocons

reg antisocial Treatment_GC COSTLESS $x_observables $x_income , robust
outreg2 using "$outputpath/Tables/Tab3_A.xls", append ctitle(All, observables) keep(Treatment_GC) addtext(Mean baseline, 0.033, Observables, Yes, Excluding non-attentive subjects, No)  stats(coef se pval)  paren(se) bracket(pval) dec(3) label  nocons

reg antisocial Treatment_GC COSTLESS $x_observables $x_income if COSTLESS==1, robust
outreg2 using "$outputpath/Tables/Tab3_A.xls", append ctitle(Costless, observables) keep(Treatment_GC) addtext(Mean baseline, 0.051, Observables, Yes, Excluding non-attentive subjects, No)  stats(coef se pval)  paren(se) bracket(pval) dec(3) label  nocons

*Means Individual
sum antisocial if Treatment_GC==0 & COSTLY==1
sum antisocial if Treatment_GC==0 & COSTLY==1 & Attention_full==1
sum antisocial if Treatment_GC==0 & COSTLESS==1


*********************************************************
****Table 3 Panel B Amount given
tab decision_main
tab decision_main, nolabel
recode decision_main (1=-1) (2=0) (3=1)

reg decision_main Treatment_GC if COSTLY==1 , robust
outreg2 using "$outputpath/Tables/Tab3_B.xls", replace ctitle(COSTLY, no controls) keep(Treatment_GC) addtext(Mean baseline, 0.11, Observables, Excluding non-attentive subjects, No)  stats(coef se pval)  paren(se) bracket(pval) dec(3) label  nocons

reg decision_main Treatment_GC $x_observables $x_income if COSTLY==1 , robust
outreg2 using "$outputpath/Tables/Tab3_B.xls", append ctitle(COSTLY, observables) keep(Treatment_GC) addtext(Mean baseline, 0.11, Observables, Yes, Excluding non-attentive subjects, No)  stats(coef se pval)  paren(se) bracket(pval) dec(3) label  nocons

reg decision_main Treatment_GC $x_observables $x_income if COSTLY==1 & Attention_full==1, robust
outreg2 using "$outputpath/Tables/Tab3_B.xls", append ctitle(COSTLY, full attention) keep(Treatment_GC) addtext(Mean baseline, 0.12, Observables, Yes, Excluding non-attentive subjects, Yes)  stats(coef se pval)  paren(se) bracket(pval) dec(3) label  nocons

reg decision_main Treatment_GC COSTLESS $x_observables $x_income, robust
outreg2 using "$outputpath/Tables/Tab3_B.xls", append ctitle(All, observables) keep(Treatment_GC) addtext(Mean baseline, 0.11, Observables, Yes, Excluding non-attentive subjects, No)  stats(coef se pval)  paren(se) bracket(pval) dec(3) label  nocons

reg decision_main Treatment_GC COSTLESS $x_observables $x_income if COSTLESS==1, robust
outreg2 using "$outputpath/Tables/Tab3_B.xls", append ctitle(Costless, observables) keep(Treatment_GC) addtext(Mean baseline, 0.17, Observables, Yes, Excluding non-attentive subjects, No)  stats(coef se pval)  paren(se) bracket(pval) dec(3) label  nocons

*Means Individual
sum decision_main if Treatment_GC==0 & COSTLY==1
sum decision_main if Treatment_GC==0 & COSTLY==1 & Attention_full==1
sum decision_main if Treatment_GC==0 & COSTLY==0


restore 

******************************************************************************************************************
*****Table A.1:  DESCRIPTIVE STATISTICS AND BALANCE TESTS, EXPERIMENT 1 (UNIVERSITY STUDENTS)
*******************************************************************************************************************

 use "$cleandatapath/Experiment1.dta", clear
 

sum Treatment
sum female age faculty_econ_mngm  Educ_mother_1 Educ_mother_2 Educ_mother_3 Educ_father_1 Educ_father_2 Educ_father_3 if Treatment<4
*female missing for 3, age for 2

iebaltab female age faculty_econ_mngm  Educ_mother_2 Educ_mother_3 Educ_father_2 Educ_father_3 if Treatment<4, grpvar(Treatment) tot feqt totallabel("Whole sample") rowvarlabels ///
grplabels(1 Individual @ 2 GroupContext_Hidden @ 3 GroupContext_Observed )  ///
savexlsx("$outputpath/Tables/TabA1.xlsx") replace  

******************************************************************************************************************
*****Table A.2: ROBUSTNESS CHECK BY GROUP VS. INDIVIDUAL COUNTERPART, PILOT EXPERIMENT 1 (SLOVAKIA, ADOLESCENTS)
*******************************************************************************************************************

use "$cleandatapath/Pilot_Experiment1.dta", replace

tab Treatment Treatment_help 
*Treatment_help==3 Group against individual counterpart
*Treatment_help==4 Group against group counterpart

*Individual Counterpart
 orth_out  JD_uncond using "$outputpath/Tables/TabA2.xlsx" if (Treatment==1|(Treatment==2 & Treatment_help==3) |(Treatment==4 & Treatment_help==3)), by(Treatment)  replace  compare  overall count bdec(3) colnum title(GROUP_INDIVIDUAL)
*Group counterpart
 orth_out  JD_uncond using "$outputpath/Tables/TabA2.xlsx" if ((Treatment==2 & Treatment_help==4) |(Treatment==4 & Treatment_help==4)), by(Treatment) vappend  compare  overall count bdec(3) colnum title(GROUP_GROUP)
 
************Nonparametric tests: Individual vs. group counterpart
*using somersd as we have two observations per person (Majority and Roma counterpart)
*2 vs. 1 (Column 5)

somersd JD_uncond Treatment if (Treatment==1|(Treatment==2 & Treatment_help==3)), cluster(ID_cluster)

*4 vs. 2 (Column 7)
*first row
somersd JD_uncond Treatment if ((Treatment==4 & Treatment_help==3)|(Treatment==2 & Treatment_help==3)), cluster(ID_cluster)
*second row 
somersd JD_uncond Treatment if ((Treatment==4 & Treatment_help==4)|(Treatment==2 & Treatment_help==4)), cluster(ID_cluster)

*4 vs. 1 (Column 9)

somersd JD_uncond Treatment if (Treatment==1|(Treatment==4 & Treatment_help==3)),  cluster(ID_cluster)

******************************************************************************************************************
*****TABLE A.3: PROPORTION OF DESTRUCTIVE AND NON-COOPERATIVE CHOICES, EXPERIMENT 1 (UNIVERSITY STUDENTS)
*******************************************************************************************************************

use "$cleandatapath/Experiment1.dta", clear
 orth_out  JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count using "$outputpath/Tables/TabA3.xlsx", by(Treatment) replace test compare  overall count bdec(2) colnum title(Experiment 1: University students) /*changed to four decimal places*/

****P-values
*Note: Chi-square test p-values used for binary outcomes (Fisher exact for a small number of observations per cell (<=5)), Wilcoxon rank-sum test for Index

***Effect of group context
*2 vs 1 (Column 5)
tab JD_ifnice Treatment if (Treatment==2|Treatment==1), chi2 exact
tab JD_ifnasty Treatment if (Treatment==2|Treatment==1), chi2 exact
tab JD_uncond Treatment if (Treatment==1|Treatment==2), chi2 exact
ranksum JD_index  if (Treatment==2|Treatment==1), by(Treatment)
tab JD_bel_count Treatment if (Treatment==2|Treatment==1), chi2 exact

tab PD_ifnice Treatment if (Treatment==2|Treatment==1), chi2 exact
tab PD_ifnasty Treatment if (Treatment==2|Treatment==1), chi2 exact
tab PD_uncond Treatment if (Treatment==2|Treatment==1), chi2 exact  
ranksum PD_index if (Treatment==2|Treatment==1), by(Treatment)  
tab PD_bel_count Treatment if (Treatment==2|Treatment==1), chi2 exact  

*3 vs 1 (Column 6)
tab JD_ifnice Treatment if (Treatment==3|Treatment==1), chi2 exact  
tab JD_ifnasty Treatment if (Treatment==3|Treatment==1), chi2 exact
tab JD_uncond Treatment if (Treatment==1|Treatment==3), chi2 exact
ranksum JD_index  if (Treatment==3|Treatment==1), by(Treatment)  
tab JD_bel_count Treatment if (Treatment==3|Treatment==1), chi2 exact  

tab PD_ifnice Treatment if (Treatment==3|Treatment==1), chi2 exact
tab PD_ifnasty Treatment if (Treatment==3|Treatment==1), chi2 exact  
tab PD_uncond Treatment if (Treatment==3|Treatment==1), chi2 exact  
ranksum PD_index if (Treatment==3|Treatment==1), by(Treatment)   
tab PD_bel_count Treatment if (Treatment==3|Treatment==1), chi2 exact  

***Effect of observability (Column 7)

tab JD_ifnice Treatment if (Treatment==3|Treatment==2), chi2 exact  
tab JD_ifnasty Treatment if (Treatment==3|Treatment==2), chi2 exact
tab JD_uncond Treatment if (Treatment==3|Treatment==2), chi2 exact
ranksum JD_index  if (Treatment==3|Treatment==2), by(Treatment)  
tab JD_bel_count Treatment if (Treatment==3|Treatment==2), chi2 exact  

tab PD_ifnice Treatment if (Treatment==3|Treatment==2), chi2 exact  
tab PD_ifnasty Treatment if (Treatment==3|Treatment==2), chi2 exact
tab PD_uncond Treatment if (Treatment==3|Treatment==2), chi2 exact
ranksum PD_index  if (Treatment==3|Treatment==2), by(Treatment)  
tab PD_bel_count Treatment if (Treatment==3|Treatment==2), chi2 exact  

***Effect of group decision-making

*4 vs 2 (Column 8)
tab JD_ifnice Treatment if (Treatment==2|Treatment==4), chi2 exact
tab JD_ifnasty Treatment if (Treatment==2|Treatment==4), chi2 exact
tab JD_uncond Treatment if (Treatment==4|Treatment==2), chi2 exact
ranksum JD_index  if (Treatment==2|Treatment==4), by(Treatment)
tab JD_bel_count Treatment if (Treatment==2|Treatment==4), chi2 exact

tab PD_ifnice Treatment if (Treatment==2|Treatment==4), chi2 exact
tab PD_ifnasty Treatment if (Treatment==2|Treatment==4), chi2 exact  
tab PD_uncond Treatment if (Treatment==2|Treatment==4), chi2 exact
ranksum PD_index if (Treatment==2|Treatment==4), by(Treatment)  
tab PD_bel_count Treatment if (Treatment==2|Treatment==4), chi2 exact

*4 vs 3 (Column 9)
tab JD_ifnice Treatment if (Treatment==3|Treatment==4), chi2 exact  
tab JD_ifnasty Treatment if (Treatment==3|Treatment==4), chi2 exact
tab JD_uncond Treatment if (Treatment==4|Treatment==3), chi2 exact  
ranksum JD_index  if (Treatment==3|Treatment==4), by(Treatment)  
tab JD_bel_count Treatment if (Treatment==3|Treatment==4), chi2 exact

tab PD_ifnice Treatment if (Treatment==3|Treatment==4), chi2 exact
tab PD_ifnasty Treatment if (Treatment==3|Treatment==4), chi2 exact  
tab PD_uncond Treatment if (Treatment==3|Treatment==4), chi2 exact
ranksum PD_index if (Treatment==3|Treatment==4), by(Treatment) 
tab PD_bel_count Treatment if (Treatment==3|Treatment==4), chi2 exact


***Overall

*4 vs. 1 (Column 10)
tab JD_ifnice Treatment if (Treatment==4|Treatment==1), chi2 exact  
tab JD_ifnasty Treatment if (Treatment==4|Treatment==1), chi2 exact
tab JD_uncond Treatment if (Treatment==4|Treatment==1), chi2 exact
ranksum JD_index  if (Treatment==4|Treatment==1), by(Treatment)  
tab JD_bel_count Treatment if (Treatment==4|Treatment==1), chi2 exact

tab PD_ifnice Treatment if (Treatment==4|Treatment==1), chi2 exact
tab PD_ifnasty Treatment if (Treatment==4|Treatment==1), chi2 exact  
tab PD_uncond Treatment if (Treatment==4|Treatment==1), chi2 exact
ranksum PD_index if (Treatment==4|Treatment==1), by(Treatment)
tab PD_bel_count Treatment if (Treatment==4|Treatment==1), chi2 exact

******************************************************************************************************************
*****TABLE A.4: PREDICTED GROUP DECISIONS USING MEDIAN INITIAL OPINION, EXPERIMENT 1 (UNIVERSITY STUDENTS)
*******************************************************************************************************************

use "$cleandatapath/Experiment1.dta", clear



***means T1-T3
	sum JD_ifnice if Treatment!=4 
	sum JD_ifnasty if Treatment!=4 
	sum JD_uncond if Treatment!=4 

	sum PD_ifnice if Treatment!=4 
	sum PD_ifnasty if Treatment!=4 
	sum PD_uncond if Treatment!=4 


***Predicted group decisions
	sum JDnice_GROUPmajority if Treatment==4
	sum JDnasty_GROUPmajority  if Treatment==4
	sum JDuncond_GROUPmajority if Treatment==4

	sum PDnice_GROUPmajority  if Treatment==4
	sum PDnasty_GROUPmajority if Treatment==4
	sum PDuncond_GROUPmajority if Treatment==4


*Actual GROUP decisions
	sum JD_ifnice if Treatment==4
	sum JD_ifnasty if Treatment==4
	sum JD_uncond if Treatment==4


	sum PD_ifnice if Treatment==4
	sum PD_ifnasty if Treatment==4
	sum PD_uncond if Treatment==4

******************************************************************************************************************
*****TABLE A.5: AGGREGATION OF PREFERENCES INTO GROUP DECISIONS, EXPERIMENT 1 (UNIVERSITY STUDENTS)
*******************************************************************************************************************
	
	
use "$cleandatapath/Experiment1.dta", clear


*Mean behavior when majority is nice (Columnn 1)
	sum JD_ifnice if Treatment==4 & JDnice_GROUPmajority==0
	sum JD_ifnasty if Treatment==4 & JDnasty_GROUPmajority==0
	sum JD_uncond if Treatment==4 & JDuncond_GROUPmajority==0

	sum PD_ifnice if Treatment==4 & PDnice_GROUPmajority==0
	sum PD_ifnasty if Treatment==4 & PDnasty_GROUPmajority==0
	sum PD_uncond if Treatment==4 & PDuncond_GROUPmajority==0

*Mean behavior when majority is nasty (Column 2)
	sum JD_ifnice if Treatment==4 & JDnice_GROUPmajority==1
	sum JD_ifnasty if Treatment==4 & JDnasty_GROUPmajority==1
	sum JD_uncond if Treatment==4 & JDuncond_GROUPmajority==1

	sum PD_ifnice if Treatment==4 & PDnice_GROUPmajority==1
	sum PD_ifnasty if Treatment==4 & PDnasty_GROUPmajority==1
	sum PD_uncond if Treatment==4 & PDuncond_GROUPmajority==1

**Comparison by group majority
*Note: P-values from a Chi-square test
ttest JD_ifnice if Treatment==4, by(JDnice_GROUPmajority)
ttest JD_ifnasty if Treatment==4, by(JDnasty_GROUPmajority)
ttest JD_uncond if Treatment==4, by(JDuncond_GROUPmajority)
tab JD_ifnice JDnice_GROUPmajority if Treatment==4, chi2 exact
tab JD_ifnasty JDnasty_GROUPmajority if Treatment==4, chi2 exact
tab JD_uncond JDuncond_GROUPmajority if Treatment==4, chi2 exact

ttest PD_ifnice if Treatment==4, by(PDnice_GROUPmajority)
ttest PD_ifnasty if Treatment==4, by(PDnasty_GROUPmajority)
ttest PD_uncond if Treatment==4, by(PDuncond_GROUPmajority)
tab PD_ifnice PDnice_GROUPmajority if Treatment==4, chi2 exact
tab PD_ifnasty PDnasty_GROUPmajority if Treatment==4, chi2 exact
tab PD_uncond PDuncond_GROUPmajority if Treatment==4, chi2 exact

******************************************************************************************************************
*****TABLE A.6: DESCRIPTIVE STATISTICS AND BALANCE TESTS, EXPERIMENT 2 (REPRESENTATIVE SAMPLE OF ADULT POPULATION)
*******************************************************************************************************************
	
	
use "$cleandatapath/Experiment2.dta", clear

*Note = column 6 - population mean - added manually from the 2011 Census
 
sum Female age_cat_1 age_cat_2 age_cat_3 age_cat_4 age_cat_5 age_cat_6 edu_ele edu_hig edu_uni size_place_1 size_place_2 size_place_3 size_place_4 size_place_5 region_1 region_2 region_3 region_4 region_5 region_6 region_7 region_8 HHincome_1 HHincome_2 HHincome_3 HHincome_4 HHincome_5 HHincome_6 HHincome_7 HHincome_8 HHincome_9 HHincome_10 

iebaltab Female age_cat_1 age_cat_2 age_cat_3 age_cat_4 age_cat_5 age_cat_6 edu_ele edu_hig edu_uni size_place_1 size_place_2 size_place_3 size_place_4 size_place_5 region_1 region_2 region_3 region_4 region_5 region_6 region_7 region_8 HHincome_1 HHincome_2 HHincome_3 HHincome_4 HHincome_5 HHincome_6 HHincome_7 HHincome_8 HHincome_9 HHincome_10 , grpvar(Treatment) tot onerow feqt totallabel("Whole sample") rowvarlabels ///
grplabels(1 Individual 2 GroupContext_Hidden)  ///
savexlsx("$outputpath/Tables/TabA6.xlsx") replace  


***Additional tests to report in the table (iebaltab can produce only t-tests or F-tests)

tab Female Treatment, chi2
tab age_cat Treatment , chi2
tab edu Treatment, chi2
tab size_place Treatment , chi2
tab region Treatment , chi2
tab HHincome Treatment , chi2

*F-statistics of the joint significance of all variables for explaining whether the subject was allocated into the GroupContext_Hidden condition
tab Treatment
recode Treatment (1=0) (2=1), gen(Treatment_GC_Hidden)
reg Treatment_GC_Hidden Female age_cat_1 age_cat_2 age_cat_3 age_cat_4 age_cat_5 age_cat_6 edu_ele edu_hig edu_uni size_place_1 size_place_2 size_place_3 size_place_4 size_place_5 region_1 region_2 region_3 region_4 region_5 region_6 region_7 region_8 HHincome_1 HHincome_2 HHincome_3 HHincome_4 HHincome_5 HHincome_6 HHincome_7 HHincome_8 HHincome_9 HHincome_10

******************************************************************************************************************
*****TABLE A.7: PROPORTION OF DESTRUCTIVE AND NON-COOPERATIVE CHOICES, EXPERIMENT 2 (REPRESENTATIVE SAMPLE OF ADULT POPULATION)
*******************************************************************************************************************
	
use "$cleandatapath/Experiment2.dta", clear
orth_out JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count using "$outputpath/Tables/TabA7.xlsx", by(Treatment) replace  compare  overall count bdec(5) colnum title(Study 4: Slovakia ONLINE 2019) nolabel

*check 
sum JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count if Treatment==1
sum JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count if Treatment==2
 
***Effect of group context
*2 vs 1
tab JD_ifnice Treatment if (Treatment==2|Treatment==1), chi2 exact
tab JD_ifnasty Treatment if (Treatment==2|Treatment==1), chi2 exact
tab JD_uncond Treatment if (Treatment==1|Treatment==2), chi2 exact
ranksum JD_index  if (Treatment==2|Treatment==1), by(Treatment)
tab JD_bel_count Treatment if (Treatment==2|Treatment==1), chi2 exact

tab PD_ifnice Treatment if (Treatment==2|Treatment==1), chi2 exact
tab PD_ifnasty Treatment if (Treatment==2|Treatment==1), chi2 exact
tab PD_uncond Treatment if (Treatment==2|Treatment==1), chi2 exact 
ranksum PD_index if (Treatment==2|Treatment==1), by(Treatment) 
tab PD_bel_count Treatment if (Treatment==2|Treatment==1), chi2 exact 
	
******************************************************************************************************************
*****TABLE A.8: ACTION BIAS TASK --- PROPORTION OF ACTIVE CHOICES, EXPERIMENT 1 (UNIVERSITY STUDENTS) AND EXPERIMENT 2 (REPRESENTATIVE SAMPLE OF ADULT POPULATION)
*******************************************************************************************************************
	
*Experiment 1 
use "$cleandatapath/Experiment1.dta", replace

bysort T_AB_GROUP: sum Actionbias 

*Experiment 2 
use "$cleandatapath/Experiment2.dta", replace

bysort Treatment: sum Actionbias 

******************************************************************************************************************
*****TABLE A.9: EFFECTS OF GROUP CONTEXT ON DESTRUCTIVE BEHAVIOR—HETEROGENEITY ACROSS SUB-GROUPS, EXPERIMENT 2 (REPRESENTATIVE SAMPLE OF ADULT POPULATION)
*******************************************************************************************************************
	
use "$cleandatapath/Experiment2.dta", clear

*Means JD_ifnice
sum JD_ifnice if Treatment==1 
sum JD_ifnice if Treatment==1 & Female==0
sum JD_ifnice if Treatment==1 & Female==1
sum JD_ifnice if Treatment==1 & age_cat==1
sum JD_ifnice if Treatment==1 & age_cat==2
sum JD_ifnice if Treatment==1 & age_cat==3
sum JD_ifnice if Treatment==1 & age_cat==4
sum JD_ifnice if Treatment==1 & age_cat==5
sum JD_ifnice if Treatment==1 & age_cat==6
sum JD_ifnice if Treatment==1 & size_place==1
sum JD_ifnice if Treatment==1 & size_place==2
sum JD_ifnice if Treatment==1 & size_place==3
sum JD_ifnice if Treatment==1 & size_place==4
sum JD_ifnice if Treatment==1 & size_place==5
sum JD_ifnice if Treatment==1 & edu_5==1
sum JD_ifnice if Treatment==1 & edu==3
sum JD_ifnice if Treatment==1 & edu==4
sum JD_ifnice if Treatment==1 & HHinc_1==1
sum JD_ifnice if Treatment==1 & HHinc_2==1
sum JD_ifnice if Treatment==1 & HHinc_3==1
sum JD_ifnice if Treatment==1 & HHinc_4==1
sum JD_ifnice if Treatment==1 & voting_p_psl==1
sum JD_ifnice if Treatment==1 & voting_p_psl==2
sum JD_ifnice if Treatment==1 & voting_p_psl==3
sum JD_ifnice if Treatment==1 & voting_p_lnk==1
sum JD_ifnice if Treatment==1 & voting_p_lnk==2
sum JD_ifnice if Treatment==1 & voting_p_lnk==3


**gender

reg JD_ifnice Treatment if Female==0, robust
outreg2 using "$outputpath/Tables/TabA9.xls", replace ctitle(Males)  dec(2) label    
reg JD_ifnice Treatment if Female==1, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append ctitle(Females)  dec(2) label


**age

reg JD_ifnice Treatment if age_cat==1, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append ctitle(18-24)  dec(2) label   
reg JD_ifnice Treatment if age_cat==2, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append ctitle(25-34)  dec(2) label   
reg JD_ifnice Treatment if age_cat==3, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append ctitle(35-44)  dec(2) label   
reg JD_ifnice Treatment if age_cat==4, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append ctitle(45-54)  dec(2) label   
reg JD_ifnice Treatment if age_cat==5, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append ctitle(55-65)  dec(2) label   
reg JD_ifnice Treatment if age_cat==6, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append ctitle(65+)  dec(2) label 

**size of municipality

reg JD_ifnice Treatment if size_place==1, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (up to 1k)   
reg JD_ifnice Treatment if size_place==2, robust            
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (1k-5k   )   
reg JD_ifnice Treatment if size_place==3, robust            
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (5k-20k  )   
reg JD_ifnice Treatment if size_place==4, robust            
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (20k-100k)   
reg JD_ifnice Treatment if size_place==5, robust            
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (100k+   )   


**edu 

reg JD_ifnice Treatment if edu_5==1, robust /*edu_5=1 if edu=1 or edu=2*/
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (Elem+Voc) 
reg JD_ifnice Treatment if edu==3, robust                
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (High-school) 
reg JD_ifnice Treatment if edu==4, robust                
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (University)   

**HH income - quartiles


reg JD_ifnice Treatment if HHinc_1==1, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append ctitle(HH income Q1)  dec(2) label    
reg JD_ifnice Treatment if HHinc_2==1, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append ctitle(HH income Q2) dec(2) label    
reg JD_ifnice Treatment if HHinc_3==1, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append ctitle(HH income Q3) dec(2) label    
reg JD_ifnice Treatment if HHinc_4==1, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append ctitle(HH income Q4)  dec(2) label   


**voting

reg JD_ifnice Treatment if voting_p_psl==1, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (Right )   
reg JD_ifnice Treatment if voting_p_psl==2, robust               
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (Middle)   
reg JD_ifnice Treatment if voting_p_psl==3, robust               
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (Left  )   

reg JD_ifnice Treatment if voting_p_lnk==1, robust
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (Liberal)   
reg JD_ifnice Treatment if voting_p_lnk==2, robust               
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (Neutral)   
reg JD_ifnice Treatment if voting_p_lnk==3, robust               
outreg2 using "$outputpath/Tables/TabA9.xls", append  dec(2) label  ctitle (Conserv)   

**voting individual parties - robustness check
tab voting_p
tab voting_p, nolabel
*all parties above 5% 
*OL'ANO=6.3%, SMER-SD=11.2%, Kotleba - L'SNS 10%, SME RODINA 10%, Za l'udi 9%, Progresivne Slovesnko -Spolu 7%

reg JD_ifnice Treatment if voting_p==3, robust
outreg2 using "$outputpath/Tables/TabA9b.xls", replace  dec(2) label  ctitle (OLANO)   
reg JD_ifnice Treatment if voting_p==6, robust               
outreg2 using "$outputpath/Tables/TabA9b.xls", append  dec(2) label  ctitle (SMER-SD)   
reg JD_ifnice Treatment if voting_p==8, robust               
outreg2 using "$outputpath/Tables/TabA9b.xls", append  dec(2) label  ctitle (Kotleba)  
reg JD_ifnice Treatment if voting_p==9, robust               
outreg2 using "$outputpath/Tables/TabA9b.xls", append  dec(2) label  ctitle (Sme rodina)  
reg JD_ifnice Treatment if voting_p==10, robust               
outreg2 using "$outputpath/Tables/TabA9b.xls", append  dec(2) label  ctitle (Za l'udi)  
reg JD_ifnice Treatment if voting_p==11, robust               
outreg2 using "$outputpath/Tables/TabA9b.xls", append  dec(2) label  ctitle (Progresivne Slovesnko -Spolu)  

******************************************************************************************************************
*****TABLE A.10: DESCRIPTIVE STATISTICS AND BALANCE TESTS, EXPERIMENT 3 (REPRESENTATIVE SAMPLE OF ADULT POPULATION)
*******************************************************************************************************************

use "$cleandatapath/Experiment3.dta", clear

keep if completed_experiment==1


tab Treatment
recode Treatment (1=2) (2=4) (3=1) (4=3), gen(Treatment_help)
tab Treatment_help

label define Treatment_help 1 "Individual_costly" 2 "GroupContext_costly" 3 "Individual_costless" 4 "GroupContext_costless"
label values Treatment Treatment

quietly tabulate Treatment, generate(Treatment_)

recode HHincome (.=99)

foreach x of varlist HHincome_1 HHincome_2 HHincome_3 HHincome_4 HHincome_5 HHincome_6 HHincome_7 HHincome_8 HHincome_9 HHincome_10 { 
replace `x'= 0 if HHincome==99
}
replace HHincome_11=1 if HHincome==99

   
***Table A.10 - randomization Experiment 5
sum Female age_cat_1 age_cat_2 age_cat_3 age_cat_4 age_cat_5 age_cat_6 edu_cat_1 edu_cat_2 edu_cat_3 size_place_1 size_place_2 size_place_3 size_place_4 size_place_5 region_1 region_2 region_3 region_4 region_5 region_6 region_7 region_8 HHincome_1 HHincome_2 HHincome_3 HHincome_4 HHincome_5 HHincome_6 HHincome_7 HHincome_8 HHincome_9 HHincome_10 HHincome_11

iebaltab Female age_cat_1 age_cat_2 age_cat_3 age_cat_4 age_cat_5 age_cat_6 edu_cat_1 edu_cat_2 edu_cat_3 size_place_1 size_place_2 size_place_3 size_place_4 size_place_5 region_1 region_2 region_3 region_4 region_5 region_6 region_7 region_8 HHincome_1 HHincome_2 HHincome_3 HHincome_4 HHincome_5 HHincome_6 HHincome_7 HHincome_8 HHincome_9 HHincome_10 HHincome_11, grpvar(Treatment_help) tot stats(pair(p) f(p))  totallabel("Whole sample") rowvarlabels ftest  ///
addnote(Notes: Descriptive statistics of the sample in Experiment 3. Columns 2-5 present means across experimental conditions. Experimental balance is tested in Column 6 using a t-test and in Column 7 using a Chi-square test. The population mean presented in Column 8 is taken from the 2021 Census (which does not include data on income). *** denotes p<0.01, ** p<0.05, and * p<0.1.) ///
savexlsx("$outputpath/Tables/TabA10.xls") replace  

tab Female Treatment, chi2
tab age_cat Treatment , chi2
tab edu_cat Treatment, chi2
tab size_place Treatment , chi2
tab region Treatment , chi2
tab HHincome Treatment , chi2

***Column 6 F-statistics (saved in the document in the bottom-most row)
reg Female Treatment_2 Treatment_3 Treatment_4
outreg2 using "$outputpath/Tables/TabA10_F_statistic.out", replace dec(2) stats(coef pval N) adds(Prob > F, e(p)) bracket(pval) label excel drop(W_OTHER S_OTHER) nocons
foreach x of varlist age_cat_1 age_cat_2 age_cat_3 age_cat_4 age_cat_5 age_cat_6 edu_cat_1 edu_cat_2 edu_cat_3 size_place_1 size_place_2 size_place_3 size_place_4 size_place_5 region_1 region_2 region_3 region_4 region_5 region_6 region_7 region_8 HHincome_1 HHincome_2 HHincome_3 HHincome_4 HHincome_5 HHincome_6 HHincome_7 HHincome_8 HHincome_9 HHincome_10 HHincome_11 { 
reg `x' Treatment_2 Treatment_3 Treatment_4
outreg2 using "$outputpath/Tables/TabA10_F_statistic.out", append dec(2) stats(coef pval N) adds(Prob > F, e(p)) bracket(pval) label excel  nocons
}

***Column 7: Chi-square test p-values
tab Female Treatment, chi2
tab age_cat Treatment , chi2
tab edu_cat Treatment, chi2
tab size_place Treatment , chi2
tab region Treatment , chi2
tab HHincome Treatment , chi2

******************************************************************************************************************
*****TABLE A.11: PROPORTION OF DESTRUCTIVE AND PROSOCIAL CHOICES, EXPERIMENT 3 (REPRESENTATIVE SAMPLE OF ADULT POPULATION)
*******************************************************************************************************************

use "$cleandatapath/Experiment3.dta", clear

*preserve 
keep if completed_experiment==1
tab Treatment

tab decision_main, nolabel
recode decision_main (1=-1) (2=0) (3=1)

*Costly destruction (standard design)
orth_out antisocial prosocial decision_main using "$outputpath/Tables/TabA11.xls" if COSTLY==1, by(Treatment_GC) replace test compare  overall count bdec(3) colnum title(Experiment 3) 
*Pooling costly and costless destruction
orth_out antisocial prosocial decision_main using "$outputpath/Tables/TabA11.xls", by(Treatment_GC) replace test compare  overall count bdec(3) colnum title(Experiment 3) 
*Costless destruction
orth_out antisocial prosocial decision_main using "$outputpath/Tables/TabA11.xls" if COSTLY==0, by(Treatment_GC) replace test compare  overall count bdec(3) colnum title(Experiment 3) 

****Comparisons
*Note: p-values from a chi-square test (binary outcomes) or a Wilcoxon rank-sum test (allocation to player B)

**Comparisons, costly destruction (column 3)
ttest antisocial if COSTLY==1, by(Treatment_GC) 
ttest prosocial  if COSTLY==1, by(Treatment_GC)
ttest decision_main if COSTLY==1, by(Treatment_GC) 

tab antisocial Treatment_GC if COSTLY==1, chi2
tab prosocial Treatment_GC if COSTLY==1, chi2
ranksum decision_main if COSTLY==1, by(Treatment_GC)

**Comparisons, pooling costly and costless destruction (column 6)

ttest antisocial, by(Treatment_GC) 
ttest prosocial, by(Treatment_GC) 
ttest decision_main, by(Treatment_GC) 

tab antisocial Treatment_GC, chi2
tab prosocial Treatment_GC, chi2
ranksum decision_main, by(Treatment_GC) 

**Comparisons, costless destruction (column 9)

ttest antisocial if COSTLY==0, by(Treatment_GC) 
ttest prosocial  if COSTLY==0, by(Treatment_GC)
ttest decision_main if COSTLY==0, by(Treatment_GC) 

tab antisocial Treatment_GC if COSTLY==0, chi2
tab prosocial Treatment_GC if COSTLY==0, chi2
ranksum decision_main if COSTLY==0, by(Treatment_GC) 
			
******************************************************************************************************************
*****TABLE A.12: PROPORTION OF DESTRUCTIVE AND NON-COOPERATIVE CHOICES, PILOT EXPERIMENT 1 (SLOVAKIA, ADOLESCENTS)
*******************************************************************************************************************


use "$cleandatapath/Pilot_Experiment1.dta", replace

sum JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count if (Treatment==1)
sum JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count if (Treatment==2)
sum JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count if (Treatment==3)
sum JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count if (Treatment==4)

orth_out  JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count using "$outputpath/Tables/TabA12.xlsx" if Treatment !=2, by(Treatment) replace test compare  overall count bdec(2) colnum title(Pilot Experiment 1: Slovakia, adolescents) 

/*Treatment == 2 manually added into table*/

***Effect of group context
*using somersd, as we have two observations per subject (Majority and Roma counterpart)

*2 vs 1
somersd JD_uncond Treatment if (Treatment==1|Treatment==2), cluster(ID_cluster)
somersd PD_uncond Treatment if (Treatment==1|Treatment==2), cluster(ID_cluster)

*3 vs. 1
somersd JD_ifnice Treatment if (Treatment==1|Treatment==3), cluster(ID_cluster)
somersd JD_ifnasty Treatment if (Treatment==1|Treatment==3), cluster(ID_cluster)
somersd JD_uncond Treatment if (Treatment==1|Treatment==3), cluster(ID_cluster)
somersd JD_index Treatment if (Treatment==1|Treatment==3), cluster(ID_cluster)
somersd JD_bel_count Treatment if (Treatment==1|Treatment==3), cluster(ID_cluster)

somersd PD_ifnice Treatment if (Treatment==1|Treatment==3), cluster(ID_cluster)
somersd PD_ifnasty Treatment if (Treatment==1|Treatment==3), cluster(ID_cluster)
somersd PD_uncond Treatment if (Treatment==1|Treatment==3), cluster(ID_cluster)
somersd PD_index Treatment if (Treatment==1|Treatment==3), cluster(ID_cluster)
somersd PD_bel_count Treatment if (Treatment==1|Treatment==3), cluster(ID_cluster)


***Effect of group decision-making

*4 vs 2
somersd JD_uncond Treatment if (Treatment==4|Treatment==2), cluster(ID_cluster)
somersd PD_uncond Treatment if (Treatment==4|Treatment==2), cluster(ID_cluster)

*4 vs. 3
somersd  JD_ifnice Treatment if (Treatment==4|Treatment==3), cluster(ID_cluster)
somersd JD_ifnasty Treatment if (Treatment==4|Treatment==3), cluster(ID_cluster)
somersd JD_uncond Treatment if (Treatment==4|Treatment==3), cluster(ID_cluster)
somersd JD_index Treatment if (Treatment==4|Treatment==3), cluster(ID_cluster)
somersd JD_bel_count Treatment if (Treatment==4|Treatment==3), cluster(ID_cluster)

somersd  PD_ifnice Treatment if (Treatment==4|Treatment==3), cluster(ID_cluster)
somersd PD_ifnasty Treatment if (Treatment==4|Treatment==3), cluster(ID_cluster)
somersd PD_uncond Treatment if (Treatment==4|Treatment==3), cluster(ID_cluster)
somersd PD_index Treatment if (Treatment==4|Treatment==3), cluster(ID_cluster)
somersd PD_bel_count Treatment if (Treatment==4|Treatment==3), cluster(ID_cluster)


***Overall

*4 vs. 1
somersd JD_ifnice Treatment if (Treatment==4|Treatment==1), cluster(ID_cluster)
somersd JD_ifnasty Treatment if (Treatment==4|Treatment==1), cluster(ID_cluster)
somersd JD_uncond Treatment if (Treatment==4|Treatment==1), cluster(ID_cluster)
somersd JD_index Treatment if (Treatment==4|Treatment==1), cluster(ID_cluster)
somersd JD_bel_count Treatment if (Treatment==4|Treatment==1), cluster(ID_cluster)

somersd PD_ifnice Treatment if (Treatment==4|Treatment==1), cluster(ID_cluster)
somersd PD_ifnasty Treatment if (Treatment==4|Treatment==1), cluster(ID_cluster)
somersd PD_uncond Treatment if (Treatment==4|Treatment==1), cluster(ID_cluster)
somersd PD_index Treatment if (Treatment==4|Treatment==1), cluster(ID_cluster)
somersd PD_bel_count Treatment if (Treatment==4|Treatment==1), cluster(ID_cluster)
	
	
******************************************************************************************************************
*****TABLE A.13: PROPORTION OF DESTRUCTIVE AND NON-COOPERATIVE CHOICES, PILOT EXPERIMENT 2 (UGANDA, ADOLESCENTS)
******************************************************************************************************************


use "$cleandatapath/Pilot_Experiment2.dta", clear


sum JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count if (Treatment==1)
sum JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count if (Treatment==2)
sum JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count if (Treatment==4)

orth_out  JD_ifnice JD_ifnasty JD_uncond  JD_index JD_bel_count PD_ifnice  PD_ifnasty PD_uncond PD_index PD_bel_count using "$outputpath/Tables/TabA13.xlsx" if Treatment !=2, by(Treatment) replace test compare  overall count bdec(2) colnum title(Study 2: Uganda FIELD 2017) 
 
/*Treatment == 2 manually added into table*/

***Effect of group context

*2 vs 1
tab JD_uncond Treatment if (Treatment==1|Treatment==2), chi2 exact
tab PD_uncond Treatment if (Treatment==1|Treatment==2), chi2 exact

***Effect of group decision-making

*4 vs 2
tab JD_uncond Treatment if (Treatment==4|Treatment==2), chi2 exact
tab PD_uncond Treatment if (Treatment==4|Treatment==2), chi2 exact

***Overall

*4 vs 1
tab JD_ifnice Treatment if (Treatment==4|Treatment==1), chi2
tab JD_ifnasty Treatment if (Treatment==4|Treatment==1), chi2
tab JD_uncond Treatment if (Treatment==4|Treatment==1), chi2
tab JD_index Treatment if (Treatment==4|Treatment==1), chi2
tab JD_bel_count Treatment if (Treatment==4|Treatment==1), chi2

tab PD_ifnice Treatment if (Treatment==4|Treatment==1), chi2
tab PD_ifnasty Treatment if (Treatment==4|Treatment==1), chi2
tab PD_uncond Treatment if (Treatment==4|Treatment==1), chi2
tab PD_index Treatment if (Treatment==4|Treatment==1), chi2
tab PD_bel_count Treatment if (Treatment==4|Treatment==1), chi2
	
******************************************************************************************************************
*****TABLE A.14: DESCRIPTIVE STATISTICS AND BALANCE TESTS, PILOT EXPERIMENT 1 (SLOVAKIA, ADOLESCENTS)
******************************************************************************************************************

use "$cleandatapath/Pilot_Experiment1.dta", clear
tab Treatment PartnerRoma

 lab var Female "Female"
 lab var Age "Age"
 lab var Siblings "Number of siblings"
 lab var MotherUnemployed "Mother unemployed" 
 lab var FatherUnemployed "Father unemployed" 
 lab var Educ_Mother_Secondary "Mother's education: High-school" 
 lab var Educ_Mother_Tertiary "Mother's education: University" 
 lab var Educ_Father_Secondary "Father's education: High-school" 
 lab var Educ_Father_Tertiary "Father's education: University" 
 lab var Car "Car"
 lab var Computer "Computer"
 lab var Television "Television"
 lab var Tablet "Tablet"
 lab var Quiz_total "Cognitive skills (0=min, 4=max)"

  /*each person in dataset are two lines - against Roma and non-Roma: if PartnerRoma==1 */
 
  tab Treatment if PartnerRoma==1 & Treatment<4
  tab Female Treatment if PartnerRoma==1 & Treatment<4
  tab MotherUnemployed Treatment if PartnerRoma==1 & Treatment<4

 ***Table A14 - randomization 
iebaltab Female Age Siblings MotherUnemployed FatherUnemployed Educ_Mother_Secondary Educ_Mother_Tertiary Educ_Father_Secondary Educ_Father_Tertiary Car Computer Television Tablet Quiz_total if PartnerRoma==1 & Treatment<4, ///
grpvar(Treatment) tot feqtest  totallabel("Whole sample") rowvarlabels ///
grplabels(1 Individual @ 2 GroupContext_1  & Group @ 3 GroupContext_2 )  ///
savexlsx("$outputpath/Tables/TabA14.xlsx") replace  

******************************************************************************************************************
*****TABLE A.15: DESCRIPTIVE STATISTICS AND BALANCE TESTS, PILOT EXPERIMENT 2 (UGANDA, ADOLESCENTS)
******************************************************************************************************************

 use "$cleandatapath/Pilot_Experiment2.dta", clear

 tab Treatment 
 
iebaltab Female age siblings MotherUnemployed FatherUnemployed Educ_Mother_Secondary Educ_Mother_Tertiary Educ_Father_Secondary Educ_Father_Tertiary  dumm_electricity_home things_at_home_10 things_at_home_1 things_at_home_3 PtsEng_2013 PtsMath_2013 if Treatment<4, ///
grpvar(Treatment) tot  feqtest  totallabel("Whole sample") rowvarlabels ///
grplabels(1 Individual @ 2 GroupContext_1  )  ///
savexlsx("$outputpath/Tables/TabA15.xlsx") replace  

******************************************************************************************************************
*****TABLE A.16: ROBUSTNESS CHECKS, PILOT EXPERIMENT 1 (SLOVAKIA, ADOLESCENTS)
******************************************************************************************************************

use "$cleandatapath/Pilot_Experiment1.dta", replace

preserve 

tab Treatment
gen GC_1=0
replace GC_1=1 if Treatment==2
gen GC_2=0
replace GC_2=1 if Treatment==3

quietly tabulate School, generate(d_school_)
quietly tabulate SchoolGrade, generate(d_grade_)
quietly tabulate Experimenter, generate(d_experimenter_)
quietly tabulate JDCQ, generate(d_JDCQ_)

global x_school d_school_2 d_school_3 d_school_4 d_school_5 d_school_6 d_school_7 d_school_8 d_school_9 d_school_10 d_school_11 d_school_12 d_school_13
global x_grade d_grade_2
global x_experimenter d_experimenter_2 d_experimenter_3 d_experimenter_4 d_experimenter_5
global x_understanding d_JDCQ_1 d_JDCQ_2 d_JDCQ_3 d_JDCQ_4 //5=full understanding, excluded
tab OrderGames //order effect
gen JD_first =0
replace JD_first=1 if OrderGames=="JDPD"

*Observables - dummy out the missing values
tab Treatment if Treatment<4
sum Female Age Siblings MotherUnemployed FatherUnemployed Educ_Mother_Secondary Educ_Mother_Tertiary Educ_Father_Secondary Educ_Father_Tertiary Car Computer Television Tablet Quiz_total if Treatment<4
recode MotherUnemployed (0/1=0) (.=1), gen(MotherUnemployed_miss)
recode MotherUnemployed (.=0)
recode FatherUnemployed (0/1=0) (.=1), gen(FatherUnemployed_miss)
recode FatherUnemployed (.=0)
recode Educ_Mother_Secondary (0/1=0) (.=1), gen(Educ_Mother_miss)
recode Educ_Mother_Secondary (.=0)
recode Educ_Mother_Tertiary (.=0)
recode Educ_Father_Secondary (0/1=0) (.=1), gen(Educ_Father_miss)
recode Educ_Father_Secondary (.=0)
recode Educ_Father_Tertiary (.=0)
recode Car (0/1=0) (.=1), gen(Car_miss)
recode Computer (0/1=0) (.=1), gen(Computer_miss)
recode Television (0/1=0) (.=1), gen(Television_miss)
recode Tablet (0/1=0) (.=1), gen(Tablet_miss)
recode Car (.=0)
recode Computer (.=0)
recode Television (.=0)
recode Tablet (.=0)
sum Female Age Siblings MotherUnemployed FatherUnemployed Educ_Mother_Secondary Educ_Mother_Tertiary Educ_Father_Secondary Educ_Father_Tertiary Car Computer Television Tablet Quiz_total if Treatment<4
sum Female Age Siblings MotherUnemployed FatherUnemployed Educ_Mother_Secondary Educ_Mother_Tertiary Educ_Father_Secondary Educ_Father_Tertiary Car Computer Television Tablet Quiz_total if Age!=. & Siblings!=. & Quiz_total!=. 

global x_observables Female Age Siblings MotherUnemployed MotherUnemployed_miss FatherUnemployed FatherUnemployed_miss Educ_Mother_Secondary Educ_Mother_Tertiary Educ_Mother_miss Educ_Father_Secondary Educ_Father_Tertiary Educ_Father_miss Car Car_miss Computer Computer_miss Television Television_miss Tablet Tablet_miss Quiz_total

**********************************************************************
***Table A.16
reg JD_uncond GC_1 GC_2 if Treatment<4, cluster(ID_cluster)
outreg2 using "$outputpath/Tables/TabA16.xls", replace ctitle(No controls) keep(GC_1 GC_2) addtext(Mean Individual, 0.32, Design, NO, Observables, NO, School and grade FE, NO, Understanding FE, NO)  dec(2) label nocons nor2

reg JD_uncond GC_1 GC_2 PartnerRoma JD_first $x_experimenter if Treatment<4, cluster(ID_cluster)
outreg2 using "$outputpath/Tables/TabA16.xls", append ctitle(Design controls) keep(GC_1 GC_2) addtext(Mean Individual, 0.32, Design, YES, Observables, NO, School and grade FE, NO, Understanding FE, NO)   dec(2) label  nocons nor2

reg JD_uncond GC_1 GC_2 PartnerRoma JD_first $x_experimenter $x_observables if Treatment<4, cluster(ID_cluster)
outreg2 using "$outputpath/Tables/TabA16.xls", append ctitle(Observables) keep(GC_1 GC_2) addtext(Mean Individual, 0.32, Design, YES, Observables , YES, School and grade FE, NO, Understanding FE, NO)   dec(2) label  nocons nor2

reg JD_uncond GC_1 GC_2 PartnerRoma JD_first $x_experimenter $x_school d_grade_2 if Treatment<4, cluster(ID_cluster)
outreg2 using "$outputpath/Tables/TabA16.xls", append ctitle(School and grade FE) keep(GC_1 GC_2) addtext(Mean Individual, 0.32, Design, YES, Observables , NO, School and grade FE, YES, Understanding FE, NO)    dec(2) label  nocons nor2

reg JD_uncond GC_1 GC_2 PartnerRoma JD_first $x_experimenter $x_understanding if Treatment<4, cluster(ID_cluster)
outreg2 using "$outputpath/Tables/TabA16.xls", append ctitle(Understanding) keep(GC_1 GC_2) addtext(Mean Individual, 0.32, Design, YES, Observables, NO, School and grade FE, NO, Understanding FE, YES)   dec(2) label  nocons nor2

reg JD_uncond GC_1 GC_2 PartnerRoma JD_first $x_experimenter if Treatment<4 & JDCQ==4, cluster(ID_cluster)
outreg2 using "$outputpath/Tables/TabA16.xls", append ctitle(Excluding non-understanding) keep(GC_1 GC_2) addtext(Mean Individual, 0.29, Design, YES, Observables , NO, School and grade FE, NO, Understanding FE, NO)   dec(2) label  nocons nor2

reg JD_uncond GC_1 GC_2 PartnerRoma JD_first $x_experimenter if Treatment<4 & JD_first==1, cluster(ID_cluster)
outreg2 using "$outputpath/Tables/TabA16.xls", append ctitle(JD played first) keep(GC_1 GC_2)addtext(Mean Individual, 0.33, Design, YES, Observables , NO, School and grade FE, NO, Understanding FE, NO)  dec(2) label  nocons nor2

logit JD_uncond GC_1 GC_2 PartnerRoma JD_first $x_experimenter if Treatment<4, cluster(ID_cluster)
mfx
outreg2 using "$outputpath/Tables/TabA16.xls", append mfx ctitle(logit) keep(GC_1 GC_2) addtext(Mean Individual, 0.32, Design, YES, Observables , NO, School and grade FE, NO, Understanding FE, NO)   dec(2) label  nocons nor2

reg JD_uncond GC_1 GC_2 PartnerRoma JD_first $x_experimenter if Treatment<4, cluster(ID_indgroup)
outreg2 using "$outputpath/Tables/TabA16.xls", append ctitle(clustering at Group level) keep(GC_1 GC_2) addtext(Mean Individual, 0.32, Design, YES, Observables, NO, School and grade FE, NO, Understanding FE, NO)   dec(2) nocons nor2

*Means Individual
sum JD_uncond if Treatment==1
sum JD_uncond if Treatment==1 & JDCQ==4
sum JD_uncond if Treatment==1 & JD_first==1

restore

******************************************************************************************************************
*****TABLE A.17: ROBUSTNESS CHECKS, PILOT EXPERIMENT 2 (UGANDA, ADOLESCENTS)
******************************************************************************************************************

use "$cleandatapath/Pilot_Experiment2.dta", replace

lab var Treatment "Treatment"

tab Treatment
gen GC_1=0
replace GC_1=1 if Treatment==2

rename age Age

quietly tabulate School, generate(d_school_)
quietly tabulate School_grade, generate(d_grade_)
quietly tab Experimenter, generate(d_experimenter_)
quietly tabulate JDCQ, generate(d_JDCQ_)

global x_school d_school_2 d_school_3 d_school_4 d_school_5 d_school_6 d_school_7 d_school_8 d_school_9 d_school_10 d_school_11 d_school_12 d_school_13 d_school_14 d_school_15 d_school_16 d_school_17 d_school_18 d_school_19 d_school_20 d_school_21 d_school_22 d_school_23 d_school_24 d_school_25 d_school_26 d_school_27 d_school_28 d_school_29 d_school_30 d_school_31 d_school_32 d_school_33 d_school_34 
global x_grade d_grade_2 d_grade_3 // P7, S3, S4
global x_experimenter d_experimenter_2 //only 2 experimenters Y and R
global x_understanding d_JDCQ_1 d_JDCQ_2 d_JDCQ_3 d_JDCQ_4 //d_JDCQ_5=full understanding, excluded


tab games_order //order effect 
gen JD_first =0
replace JD_first=1 if games_order=="JDPDPUZ" | games_order=="PUZJDPD"
tab games_order JD_first

*Observables - dummy out the missing values
tab Treatment if Treatment<4
sum Female Age siblings MotherUnemployed FatherUnemployed Educ_Mother_Secondary Educ_Mother_Tertiary Educ_Father_Secondary Educ_Father_Tertiary  dumm_electricity_home things_at_home_10 things_at_home_1 things_at_home_3 PtsEng_2013 PtsMath_2013 if Treatment<4
recode Female (0/1=0) (.=1), gen(Female_miss)
recode Female (.=0)
recode MotherUnemployed (0/1=0) (.=1), gen(MotherUnemployed_miss)
recode MotherUnemployed (.=0)
recode FatherUnemployed (0/1=0) (.=1), gen(FatherUnemployed_miss)
recode FatherUnemployed (.=0)
recode Educ_Mother_Secondary (0/1=0) (.=1), gen(Educ_Mother_miss)
recode Educ_Mother_Secondary (.=0)
recode Educ_Mother_Tertiary (.=0)
recode Educ_Father_Secondary (0/1=0) (.=1), gen(Educ_Father_miss)
recode Educ_Father_Secondary (.=0)
recode Educ_Father_Tertiary (.=0)
recode dumm_electricity_home (0/1=0) (.=1), gen(electricity_miss)
recode things_at_home_10 (0/1=0) (.=1), gen(things_10_miss)
recode things_at_home_1 (0/1=0) (.=1), gen(things_1_miss)
recode things_at_home_3 (0/1=0) (.=1), gen(things_3_miss)
recode dumm_electricity_home  (.=0)
recode things_at_home_10 (.=0)
recode things_at_home_1 (.=0)
recode things_at_home_3 (.=0)
sum Female Age siblings MotherUnemployed FatherUnemployed Educ_Mother_Secondary Educ_Mother_Tertiary Educ_Father_Secondary Educ_Father_Tertiary dumm_electricity_home things_at_home_10 things_at_home_1 things_at_home_3 PtsEng_2013 PtsMath_2013 if Treatment<4
sum Female Age siblings MotherUnemployed FatherUnemployed Educ_Mother_Secondary Educ_Mother_Tertiary Educ_Father_Secondary Educ_Father_Tertiary dumm_electricity_home things_at_home_10 things_at_home_1 things_at_home_3 PtsEng_2013 PtsMath_2013 if (Age!=. & siblings!=. & PtsEng_2013!=. & PtsMath_2013!=.) &  JD_uncond!=.

global x_observables Female Female_miss Age siblings MotherUnemployed MotherUnemployed_miss FatherUnemployed FatherUnemployed_miss Educ_Mother_Secondary Educ_Mother_Tertiary Educ_Mother_miss Educ_Father_Secondary Educ_Father_Tertiary Educ_Father_miss dumm_electricity_home electricity_miss things_at_home_10 things_10_miss things_at_home_1 things_1_miss things_at_home_3 things_3_miss PtsEng_2013 PtsMath_2013

*****************************************************
***Table A.17
reg JD_uncond GC_1 if Treatment<4, robust
outreg2 using "$outputpath/Tables/TabA17.xls", replace ctitle(No controls) keep(GC_1) addtext(Mean Individual, 0.53, Design, NO, Observables, NO, School and grade FE, NO, Understanding FE, NO)  dec(2) label nocons nor2

reg JD_uncond GC_1 JD_first $x_experimenter if Treatment<4, robust
outreg2 using "$outputpath/Tables/TabA17.xls", append ctitle(Design) keep(GC_1) addtext(Mean Individual, 0.53, Design, YES, Observables, NO, School and grade FE, NO, Understanding FE, NO)  dec(2) label nocons nor2

reg JD_uncond GC_1 JD_first $x_experimenter $x_observables if Treatment<4, robust
outreg2 using "$outputpath/Tables/TabA17.xls", append ctitle(Observables) keep(GC_1) addtext(Mean Individual, 0.53, Design, YES, Observables, YES, School and grade FE, NO, Understanding FE, NO) dec(2) label nocons nor2

reg JD_uncond GC_1 JD_first $x_experimenter $x_school $x_grade if Treatment<4, robust
outreg2 using "$outputpath/Tables/TabA17.xls", append ctitle(School and grade FE) keep(GC_1) addtext(Mean Individual, 0.53, Design, YES, Observables, NO, School and grade FE, YES, Understanding FE, NO)   dec(2) label nocons nor2

reg JD_uncond GC_1 JD_first $x_experimenter $x_understanding if Treatment<4, robust
outreg2 using "$outputpath/Tables/TabA17.xls", append ctitle(Understanding) keep(GC_1) addtext(Mean Individual, 0.53, Design, YES, Observables, NO, School and grade FE, NO, Understanding FE, YES)   dec(2) label nocons nor2

reg JD_uncond GC_1 JD_first $x_experimenter if Treatment<4 & JDCQ==4, robust
outreg2 using "$outputpath/Tables/TabA17.xls", append ctitle(Excluding non-und) keep(GC_1) addtext(Mean Individual, 0.52, Design, YES, Observables , NO, School and grade FE, NO, Understanding FE, NO)  dec(2) label nocons  nor2

reg JD_uncond GC_1 if Treatment<4 & JD_first==1, robust
outreg2 using "$outputpath/Tables/TabA17.xls", append ctitle(Only JD played first) keep(GC_1) addtext(Mean Individual, 0.47, Design, YES, Observables, NO, School and grade FE, NO, Understanding FE, NO)    dec(2) label nocons nor2

logit JD_uncond GC_1 JD_first $x_experimenter if Treatment<4, robust
mfx
outreg2 using "$outputpath/Tables/TabA17.xls", append mfx ctitle(logit) keep(GC_1) addtext(Mean Individual, 0.53, Design, YES, Observables, NO, School and grade FE, NO, Understanding FE, NO)  dec(2) label nocons nor2

reg JD_uncond GC_1 JD_first $x_experimenter if Treatment<4, cluster(ID_indgroup)
outreg2 using "$outputpath/Tables/TabA17.xls", append ctitle(Design) keep(GC_1) addtext(Mean Individual, 0.53, Design, YES, Observables, NO, School and grade FE, NO, Understanding FE, NO)  dec(2) label nocons nor2

*Means Individual
sum JD_uncond if Treatment==1
sum JD_uncond if Treatment==1 & JDCQ==4
sum JD_uncond if Treatment==1 & JD_first==1

******************************************************************************************************************
*****TABLE A.18: DESCRIPTIVE STATISTICS AND BALANCE TESTS, SUPPLEMENTARY EXPERIMENT (SLOVAKIA, REPRESENTATIVE SAMPLE 50-65 Y.O.)
******************************************************************************************************************

use "$cleandatapath/Supplementary_Experiment.dta", clear
tab Treatment 

sum Female AGE REG1 REG2 REG3 REG4 REG5 REG6 REG7 REG8 EDU2 EDU3 EDU4 EDU5 EDU6 SIZE1 SIZE2 SIZE3 SIZE4 SIZE5 T_TOKS T_T1 T_T2 T_T3

iebaltab Female AGE REG1 REG2 REG3 REG4 REG5 REG6 REG7 REG8 EDU2 EDU3 EDU4 EDU5 EDU6 SIZE1 SIZE2 SIZE3 SIZE4 SIZE5 T_TOKS T_T1 T_T2 T_T3, grpvar(Treatment) tot feqt totallabel("Whole sample") rowvarlabels ///
grplabels(0 "JDG standard" 1 "JDG with prosocial option")  ///
savexlsx("$outputpath/Tables/TabA18.xls") replace  

tab Female Treatment, chi2 /*p=0.04 - more women in T=0 (2 options) 58% vs 51% */
tab REG Treatment, chi2  /*p=0.383 similar percentage of regions in both treatments*/
tab EDU Treatment, chi2  /*p=0.490 similar percentage of education in both treatments*/
tab SIZE Treatment, chi2  /*p=0.222 similar percentage of size of municipality in both treatments*/

ttest antisocial, by(Treatment) /*p=0.580*/
tab antisocial Treatment, chi2 /*p=0.580*/

reg antisocial Treatment Female AGE EDU3 EDU4 EDU5 EDU6  REG2 REG3 REG4 REG5 REG6 REG7 REG8 SIZE2 SIZE3 SIZE4 SIZE5 T_TOKS T_T1 T_T2 T_T3, robust /*p=0.638*/
******************************************************************************************************************

log close
